package com.shuyuansystem.utils;

import lombok.Data;
import java.io.Serializable;
import java.util.List;

/**
 * 分页结果封装对象
 */
@Data
public class PageResult<T> implements Serializable {
    private Long total; // 总记录数
    private List<T> rows; // 当前页结果

    public PageResult() {
    }

    public PageResult(Long total, List<T> rows) {
        if (total == null || total < 0) {
            throw new IllegalArgumentException("Total records cannot be negative or null.");
        }
        if (rows == null) {
            throw new IllegalArgumentException("Rows list cannot be null.");
        }
        this.total = total;
        this.rows = rows;
    }
}